package com.lefevre.cms.bean.favorite;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 话题收藏
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("topic_favorite")
@Entity
@Table(name = "topic_favorite", indexes = {@Index(name = "topicFavorite_1_idx", columnList = "topicId,addtime")})
public class TopicFavorite implements Serializable {

    private static final long serialVersionUID = 6369571392400904412L;

    /**
     * ID 格式(话题Id_用户Id)
     **/
    @Id
    @Column(length = 50)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 话题收藏的用户名称
     **/
    @Column(length = 30)
    @TableField("userName")
    protected String userName;

    /**
     * 发布话题的用户名称
     **/
    @Column(length = 30)
    @TableField("postUserName")
    protected String postUserName;

    /**
     * 加入时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("addtime")
    protected Date addtime = new Date();

    /**
     * 话题Id
     **/
    @TableField("topicId")
    protected Long topicId;

    /**
     * 话题标题
     **/
    @Transient
    @TableField(exist = false)
    protected String topicTitle;

}
